<?php
namespace app\mall_back\controller;

use app\mall_back\model\TescoRecordModel;
use app\mall_back\model\GoodsLuckyDrawModel;
use app\data\model\DataUser;
use think\admin\Controller;
use think\admin\helper\QueryHelper;

class TescoRecord extends Controller{

    /**
     * 开奖记录
     * @auth true
     */
    public function index(){
        TescoRecordModel::mQuery()->where(['is_win'=>1])->layTable(function (QueryHelper $helper) {
            $this->title = '开奖记录';

        });
    }

    //数据列表处理
    protected function _page_filter(array &$data)
    {
        foreach ($data as $k => &$v){
            $v['user_phone'] = DataUser::where('id','=',$v['u_id'])->value('phone');
            $v['win_time'] = GoodsLuckyDrawModel::where('id','=',$v['goods_lucky_draw_id'])->value('win_time');
        }

    }


}